<template>
  <div class="task-report">
    <el-form label-position="left" class="demo-table-expand" label-width="100px">
      <template v-if="taskData.status > 1">
        <el-row>
          <el-col :span="12">
            <el-form-item label="执行方式" prop="cate">
              <span v-if="taskData.executeType == 1">执行预案</span>
              <span v-if="taskData.executeType == 2">指派任务</span>
              <span v-if="taskData.executeType == 4">立即执行</span>
              <span v-if="taskData.executeType == 3">终止任务</span>
            </el-form-item>
          </el-col>
        </el-row>
        <template v-if="taskData.executeType == 3">
          <el-row>
            <el-col :span="24">
              <el-form-item label="终止原因">
                <span>{{ taskData.submitContent }}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="终止时间">
                {{ taskData.submitTime }}
              </el-form-item>
            </el-col>
          </el-row>
        </template>
        <template v-if="taskData.executeType == 4">
          <el-row>
            <el-col :span="24">
              <el-form-item label="任务反馈">
                <span>{{ taskData.submitContent }}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="反馈文件">
                <el-button type="text" @click="handleTaskReportAttach(taskData)">查看任务反馈文件>></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="反馈时间">
                {{ taskData.submitTime }}
              </el-form-item>
            </el-col>
          </el-row>
        </template>
      </template>
      <template v-else>
        <el-row>
          <el-col :span="24">
            <el-form-item label="任务反馈">
              <span>任务未完成</span>
            </el-form-item>
          </el-col>
        </el-row>
      </template>
    </el-form>
    <task-report-attach ref="taskReportAttach" />
  </div>
</template>
<script>
import TaskReportAttach from "@/views/response/report/components/TaskReportAttach.vue";

export default {
  name: "TaskSubmitView",
  props: ["taskData"],
  components: { TaskReportAttach },
  methods: {
    handleTaskReportAttach(data) {
      this.$refs.taskReportAttach.showDialog(data.taskId);
    },
  },
};
</script>
<style lang="scss" scoped>
.task-report {
  padding: 0 20px 20px;
}
</style>
